﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// 提现记录表
/// </summary>
[Table("WithdrawalRecord")]
[Index("WithdrawalAccountId", Name = "idx_WithdrawalRecord_SettlementAccountId")]
[Index("UserId", Name = "idx_WithdrawalRecord_UserId")]
public partial class WithdrawalRecord
{
    /// <summary>
    /// 提现记录ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 用户ID
    /// </summary>
    [StringLength(32)]
    public string UserId { get; set; } = null!;

    /// <summary>
    /// 提现账户ID
    /// </summary>
    [StringLength(32)]
    public string? WithdrawalAccountId { get; set; }

    /// <summary>
    /// 账户交易记录ID
    /// </summary>
    [StringLength(32)]
    public string AccountTransactionId { get; set; } = null!;

    /// <summary>
    /// 提现金额
    /// </summary>
    public long Amount { get; set; }

    /// <summary>
    /// 提现手续费
    /// </summary>
    public long? Fee { get; set; }

    /// <summary>
    /// 费率
    /// </summary>
    public decimal? FeeRate { get; set; }

    /// <summary>
    /// 实际到账金额
    /// </summary>
    public long ActualAmount { get; set; }

    /// <summary>
    /// 商户ID
    /// </summary>
    [StringLength(32)]
    public string? MerchantId { get; set; }

    /// <summary>
    /// 版本号（3.0）
    /// </summary>
    [StringLength(255)]
    public string? Version { get; set; }

    /// <summary>
    /// 商户编号（平台商户编号）
    /// </summary>
    [StringLength(32)]
    public string CustomerCode { get; set; } = null!;

    /// <summary>
    /// 提现的商户订单号
    /// </summary>
    [StringLength(32)]
    public string OutTradeNo { get; set; } = null!;

    /// <summary>
    /// 分账商户编号
    /// </summary>
    [StringLength(32)]
    public string MemberId { get; set; } = null!;

    /// <summary>
    /// 绑卡协议号
    /// </summary>
    [StringLength(40)]
    public string? Protocol { get; set; }

    /// <summary>
    /// 提现金额，单位为分
    /// </summary>
    public long? PayAmount { get; set; }

    /// <summary>
    /// 到账类型（默认 0，最大 99；0：当日到账；1：
    /// 次日到账，依此类推）
    /// </summary>
    public int? ArrivalType { get; set; }

    /// <summary>
    /// 银行卡标签
    /// </summary>
    [StringLength(10)]
    public string? BankCardId { get; set; }

    /// <summary>
    /// 是否全额（0：非全额，1：全额
    /// 如果 isFullAmount 填了 1，则不管
    /// payAmount 的值）
    /// </summary>
    public int? IsFullAmount { get; set; }

    /// <summary>
    /// 手续费扣除商户
    /// </summary>
    [StringLength(32)]
    public string? ProcedureCustomerCode { get; set; }

    /// <summary>
    /// 商户服务费（单位分，默认 0）
    /// </summary>
    public long? ServiceFee { get; set; }

    /// <summary>
    /// 支付币种（默讣 CNY:人民币）
    /// </summary>
    [StringLength(16)]
    public string? PayCurrency { get; set; }

    /// <summary>
    /// 异步通知地址
    /// </summary>
    [StringLength(255)]
    public string? NotifyUrl { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [StringLength(40)]
    public string? Remark { get; set; }

    /// <summary>
    /// 摘要
    /// </summary>
    [StringLength(40)]
    public string? Summary { get; set; }

    /// <summary>
    /// 随机字符串
    /// </summary>
    [StringLength(32)]
    public string? NonceStr { get; set; }

    /// <summary>
    /// 服务费收取状态（1：服务费收取成功，0或null：未收取服务费）
    /// </summary>
    public int? ServiceFeeState { get; set; }

    /// <summary>
    /// 易票联订单号
    /// </summary>
    [StringLength(255)]
    public string? TransactionNo { get; set; }

    /// <summary>
    /// 手续费（单位分）
    /// </summary>
    public long? ProcedureFee { get; set; }

    /// <summary>
    /// 实际提现到账金额（单位分，等于提现金额-手续费）
    /// </summary>
    public long? ActualFee { get; set; }

    /// <summary>
    /// 支付结果（00=成功，01=失败，03=处理中，04=延迟处理中）
    /// </summary>
    [StringLength(2)]
    public string? PayResult { get; set; }

    /// <summary>
    /// 原因说明
    /// </summary>
    [StringLength(255)]
    public string? ChannelQueryMsg { get; set; }

    /// <summary>
    /// 提现完成时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? PayTime { get; set; }

    /// <summary>
    /// 渠道类型（0：门户；1：接口；2：自动提现）
    /// </summary>
    [StringLength(1)]
    public string? ChannelType { get; set; }

    /// <summary>
    /// 收款人姓名
    /// </summary>
    [StringLength(20)]
    public string? BankUserName { get; set; }

    /// <summary>
    /// 银行卡号
    /// </summary>
    [StringLength(34)]
    public string? BankCardNo { get; set; }

    /// <summary>
    /// 银行名称
    /// </summary>
    [StringLength(80)]
    public string? BankName { get; set; }

    /// <summary>
    /// 系统提现状态（0=处理中，1=成功，2=失败，3=延迟处理中）
    /// </summary>
    public int? WithdrawalStatus { get; set; }

    /// <summary>
    /// 提现状态（00=成功，01=失败，03=处理中，04=延迟处理中）
    /// </summary>
    [StringLength(2)]
    public string? PayState { get; set; }

    /// <summary>
    /// 扩展属性
    /// </summary>
    public string? ExtraProperties { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 最后修改时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? LastModificationTime { get; set; }

    /// <summary>
    /// 请求参数JSON
    /// </summary>
    [Column(TypeName = "jsonb")]
    public string? RequestData { get; set; }

    /// <summary>
    /// 回调参数JSON
    /// </summary>
    [Column(TypeName = "jsonb")]
    public string? CallbackData { get; set; }

    /// <summary>
    /// 请求后响应JSON
    /// </summary>
    [Column(TypeName = "jsonb")]
    public string? ApiResponse { get; set; }

    /// <summary>
    /// 易票联分账记录ID
    /// </summary>
    [StringLength(32)]
    public string? EpaylinksSplitRecordId { get; set; }
}
